var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var _ = require("underscore");

//定义model的规范
var newSchema = new Schema({
    name: String, //商品名称
    price: Number,//商品价格
    note: String,//商品备注
    category_id: String,//商品目录ID
    category_name: String,//商品目录名称
    pic_url: String,//商品图片
    system_user_id: String,//系统用户ID
    create_date: Date //创建目录日期
});

newSchema.virtual('price_cn').get(function () {
    return this.price / 100;
});

//注册model
mongoose.model("CafeGoods", newSchema);

//获得Model
var CafeGoods = mongoose.model("CafeGoods");

module.exports = CafeGoods;